package ru.romannep.and.chopperbattle;

import android.app.Activity;
import android.os.Bundle;
import android.text.Spannable;
import android.text.method.MovementMethod;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.TextView;

public class Network extends Activity implements OnClickListener {
	private TextView editChatMessage;
	private TextView messageLog;
	private ScrollView messageLogScroll;
	@Override 
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.network);
		findViewById(R.id.button_send).setOnClickListener(this);
		editChatMessage = (TextView) findViewById(R.id.editChatMessage);
		messageLog = (TextView) findViewById(R.id.messageLog);
		messageLogScroll = (ScrollView) findViewById(R.id.messageLogScroll);
		//messageLog.setMovementMethod(new ScrollingMovementMethod());
	}

	@Override
	public void onClick(View v) {

		Log.v(ChopperBattleMain.TAG,"clicked on id =" + v.getId());
		switch (v.getId()) {
		case R.id.button_send:
			messageLog.setText("" + messageLog.getText() + editChatMessage.getText() +"\n");
			editChatMessage.setText("");
			messageLogScroll.smoothScrollTo(0, messageLog.getBottom());
			break;

		default:
			break;
		}
		
	}

}
